<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul id="commentList">
        <li class="comment">
            <div class="comment-content">
                <p>这是一条评论内容</p>
                <p>作者：张三</p>
                <p>时间：2023-09-20</p>
            </div>
            <button class="delete-btn">删除</button>
            <button class="report-btn">举报</button>
        </li>
        <li class="comment">
            <div class="comment-content">
                <p>这是另一条评论内容</p>
                <p>作者：李四</p>
                <p>时间：2023-09-21</p>
            </div>
            <button class="delete-btn">删除</button>
            <button class="report-btn">举报</button>
        </li>
    </ul>
    <button id="addCommentBtn">添加评论</button>

</body>
<script>
    window.onload = function () {
        const li = document.querySelectorAll('.comment');
        li.forEach(item => {
            const deleteBtn = item.querySelector('.delete-btn');
            const reportBnt = item.querySelector('.report-btn');
            deleteBtn.addEventListener('click', function () {
                console.log('删除成功')
            })
            reportBnt.addEventListener('click', function () {
                console.log('举报成功')
            })
        })
    }

</script>

</html>